// 删除vip
function del() {
    var row = $('#dgVip').datagrid('getSelected');
    if (row != null) {
        if (row.state == 1) {
            $.messager.alert('提示', "该状态不可执行此操作，请刷新后重试！")
            return;
        }
        $.messager.confirm('提示信息', '真的要冻结' + row.huiyuanming + '吗?',
            function (r) {
                if (r) {
                    $.ajax({
                        url: path + '/vip/delvip.do',
                        data: {
                            id: row.id,
                            state: 1
                        },
                        dataType: 'json',
                        success: function (data) {
                            if (data.code == 200) {
                                $.messager.show({
                                    title: '提示',
                                    msg: '冻结成功！',
                                    timeout: 5000,
                                    showType: 'slide'
                                })
                                doSearch();
                            } else {
                                $.messager.alert('信息提示', data.msg, 'info');
                            }
                        }

                    })

                }
            });

    } else {
        $.messager.alert("提示", '请选择要冻结的会员!')
    }
}

function reset() {
    var row = $('#dgVip').datagrid('getSelected');
    if (row != null) {
        if (row.state == 0) {
            $.messager.alert("提示", "该状态不可执行此操作，请刷新后重试！")
            return;
        }
        $.messager.confirm('提示信息', '真的要恢复' + row.huiyuanming + '吗?',
            function (r) {
                if (r) {
                    $.ajax({
                        url: path + '/vip/delvip.do',
                        data: {
                            id: row.id,
                            state: 0
                        },
                        dataType: 'json',
                        success: function (data) {
                            if (data.code == 200) {
                                $.messager.show({
                                    title: '提示',
                                    msg: '恢复成功！',
                                    timeout: 5000,
                                    showType: 'slide'
                                })
                                $("#dgVip").datagrid()
                            } else {
                                $.messager.alert('信息提示', data.msg, 'info');
                            }
                        }

                    })

                }
            });

    } else {
        $.messager.alert("提示", '请选择要恢复的会员!')
    }
}
